package com.zust.java.util;

import java.util.HashMap;
import java.util.Map;

public class StmtMap {

	private static Map<StmtCode, String> map = new HashMap<StmtCode, String>();
	private static String AccountMapping = "com.zust.java.mybatis.mapping.AccountMapping.";
	private static String CompleteDetailMapping = "com.zust.java.mybatis.mapping.CompleteDetailMapping.";
	private static String JobShopMapping = "com.zust.java.mybatis.mapping.JobShopMapping.";
	private static String OrderDetailMapping = "com.zust.java.mybatis.mapping.OrderDetailMapping.";
	private static String OrderMapping = "com.zust.java.mybatis.mapping.OrderMapping.";
	private static String ProductMapping = "com.zust.java.mybatis.mapping.ProductMapping.";
	private static String OrderViewMapping = "com.zust.java.mybatis.mapping.OrderViewMapping.";
	private static String ProcessorViewMapping = "com.zust.java.mybatis.mapping.ProcessorViewMapping.";
	private static String SequenceMapping = "com.zust.java.mybatis.mapping.SequenceMapping.";
	
	static {
		// Account
		map.put(StmtCode.INSERT_ACCOUNT, AccountMapping.concat("insertAccount"));
		map.put(StmtCode.DETELE_ACCOUNT, AccountMapping.concat("deleteAccount"));
		map.put(StmtCode.UPDATE_ACCOUNT, AccountMapping.concat("updateAccount"));
		map.put(StmtCode.SELECT_ACCOUNT, AccountMapping.concat("selectAccount"));
		map.put(StmtCode.SELECT_ACCOUNT_BY_ID, AccountMapping.concat("selectAccountById"));
		map.put(StmtCode.SELECT_ACCOUNT_BY_NAME, AccountMapping.concat("selectAccountByName"));
		map.put(StmtCode.SELECT_ACCOUNT_BY_ACCOUNT_ID, AccountMapping.concat("selectAccountByAccountId"));
		
		// CompleteDetail
		map.put(StmtCode.INSERT_CDETAIL, CompleteDetailMapping.concat("insertCdetail"));
		map.put(StmtCode.UPDATE_CDETAIL, CompleteDetailMapping.concat("updateCdetail"));
		map.put(StmtCode.SELECT_CDETAIL, CompleteDetailMapping.concat("selectCdetail"));
		map.put(StmtCode.GET_ID, CompleteDetailMapping.concat("selectId"));

		// JobShop
		map.put(StmtCode.INSERT_JOBSHOP, JobShopMapping.concat("insertJobShop"));
		map.put(StmtCode.UPDATE_JOBSHOP, JobShopMapping.concat("updateJobShop"));
		map.put(StmtCode.SELECT_JOBSHOP_BY_ID, JobShopMapping.concat("selectJobShopById"));
		map.put(StmtCode.SELECT_JOBSHOP_AND_ORDER, JobShopMapping.concat("selectJobShopAndOrder"));
		map.put(StmtCode.SELECT_JOBSHOP_BY_ACCOUNT_ID, JobShopMapping.concat("selectJobShopByAccountId"));
		
		// OrderDetailMap
		map.put(StmtCode.INSERT_ORDER_DETAIL, OrderDetailMapping.concat("insertOrderDetail"));
		map.put(StmtCode.DELETE_ORDER_DETAIL, OrderDetailMapping.concat("deleteOrderDetail"));
		map.put(StmtCode.DELETE_ORDER_DETAIL_BY_ORDER_ID, OrderDetailMapping.concat("deleteOrderDetailByOrderId"));
		map.put(StmtCode.UPDATE_ORDER_DETAIL, OrderDetailMapping.concat("updateOrderDetail"));
		map.put(StmtCode.ADD_CDETAIL_ID, OrderDetailMapping.concat("addCdetailId"));
		map.put(StmtCode.SELECT_ORDER_DETAIL, OrderDetailMapping.concat("selectOrderDetail"));
		map.put(StmtCode.SELECT_ORDER_DETAIL_BY_ID, OrderDetailMapping.concat("selectOrderDetailById"));

		// Order
		map.put(StmtCode.INSERT_ORDER, OrderMapping.concat("insertOrder"));
		map.put(StmtCode.DELETE_ORDER, OrderMapping.concat("deleteOrder"));
		map.put(StmtCode.UPDATE_ORDER, OrderMapping.concat("updateOrder"));
		map.put(StmtCode.SELECT_ORDER_WITH_DETAIL, OrderMapping.concat("selectOrderWithDetail"));
		map.put(StmtCode.SELECT_ORDER_BY_ID, OrderMapping.concat("selectOrderById"));
		map.put(StmtCode.SELECT_ORDER_BY_ACCOUNT_ID, OrderMapping.concat("selectOrderByAccountId"));
		map.put(StmtCode.SELECT_ORDER_AND_ACCOUNT, OrderMapping.concat("selectOrderAndAccount"));
		map.put(StmtCode.SELEECT_ORDER_AND_JOBSHOP, OrderMapping.concat("selectOrderAndJobShop"));
		map.put(StmtCode.UPDATE_ORDER_JOBSHOP, OrderMapping.concat("updateOrderJobShop"));
		map.put(StmtCode.SELECT_ORDER_BY_NO, OrderMapping.concat("selectOrderByNo"));
		map.put(StmtCode.SELECT_ORDER_BY_NULL_JOB, OrderMapping.concat("selectOrderByNullJob"));
		
		// Product
		map.put(StmtCode.SELECT_PRODUCT, ProductMapping.concat("selectProduct"));
		map.put(StmtCode.SELECT_PRODUCT_BY_ID, ProductMapping.concat("selectProductById"));
		
		// OrderView
		map.put(StmtCode.SELECT_ORDER_VIEW_BY_USERNAME, OrderViewMapping.concat("selectOrderViewByUsername"));
		map.put(StmtCode.SELECT_ORDER_VIEW_BY_ACCOUNT_ID, OrderViewMapping.concat("selectOrderViewByAccountId"));
		
		// ProcessorView
		map.put(StmtCode.SELECT_BY_USERNAME, ProcessorViewMapping.concat("selectByUsername"));
		
		// Sequence
		map.put(StmtCode.SELECT_CURRENT_VALUE, SequenceMapping.concat("selectCurrentValue"));
	}

	public static String getStmt(StmtCode cmd) {
		return map.get(cmd);
	}
}
